﻿using System;
using System.Collections;
using System.Collections.Generic;


namespace DailyFx
{
	public enum Stylus
	{
		/// <summary>
		///		Which'll not drawn on the chart .
		/// </summary>
		HIDDEN,

		/// <summary>
		///		Mainly of most indicator's stylish like MA, ATR etc.
		/// </summary>
		LINE,

		/// <summary>
		///		Separated dot stylish for indicator like Parabolic SAR .
		/// </summary>
		SCATTER,

		/// <summary>
		///		'Non-Smooth' type of indicator like MACD, Aroon
		/// </summary>
		HISTOGRAM,

		/// <summary>
		///		'Non-Linear' type of indicator like Fibonacci, Donchian Channel etc.
		/// </summary>
		EXP_LEVEL,     // 

		/// <summary>
		///		'Banding, RegionBuffered' - like indicator as Ichimoku Kinko Hyo, Bollinger bands etc.
		/// </summary>
		REGION
	}

	public enum Layout
	{

		/// <summary>
		///		Overlapped, on the Main chart.
		/// </summary>
		OVERLAY,

		/// <summary>
		///		Seperated, on child window .
		/// </summary>
		SLAVE,

		/// <summary>
		///     Diff types of children, let'em plotting respectively .
		/// </summary>
		HYBRID,

	}

	public class HyperVector : IVector
	{
		/// <summary>
		//		Contains all cooked values .
		/// </summary>
		private readonly Decimal[] _values;

		/// <summary>
		///		the family of parent <see cref="IIndex"/>
		/// </summary>
		//	private readonly string _family;
		
		/// <summary>
		///		the label text .
		/// </summary>
		private readonly String _label;

		/// <summary>
		///		the canvas  .
		/// </summary>
		private readonly Layout _layout;

		/// <summary>
		///		the stylish of brush  .
		/// </summary>
		private readonly Stylus _stylus;

		/// <summary>
		///		the color of brush .
		/// </summary>
		private readonly uint _color;

		/// <summary>
		///		the index in the parent <see cref="IIndex"/>
		/// </summary>
		private readonly Int32 mRadix;


		/// <summary>
		///     c'tor
		/// </summary>
		public HyperVector (	Int32 length /** capacity */,
								String label, Layout layout, Stylus stylus, uint color )
		{
			this._values = new Decimal[ length ];

			//	this._family = family;
			this._label		= label;
			this._layout	= layout;
			this._stylus	= stylus;
			this._color		= color;

			//
			// this.mRadix = radix;
		}


		/// <summary>
		///		Gets label text to display.
		/// </summary>
		public String Label 
		{
			get { return _label; }
		}

		/// <summary>
		///		Gets hints of canvas   .
		/// </summary>
		Layout Layout 
		{
			get { return _layout; }
		}

		/// <summary>
		///		Gets the stylish of brush  .
		/// </summary>
		public  Stylus Stylus
		{
			get { return _stylus; }
		}

		/// <summary>
		///		Gets the color of brush .
		/// </summary>
		public virtual uint Color
		{
			get{ return _color; }
		}

		/// <summary>
		///		Gets the cooked value at specified index .
		/// </summary>
		public decimal this [ int index ]
		{
		    get {
		        return this._values [ index ];
		    }
			set {
 				this._values[ index ] = value; 
			}
		}

		/// <summary>
		///		Gets radix number in complex indicator .
		/// </summary>
		public Int32 Radix 
		{
			get { return mRadix; }
		}

		/// <summary>
		///		Indicates this is vector 1D .
		/// </summary>
		int IVariant.Rank
		{
			get { return 1; }
		}
		//
		public int Length // use with caution .
		{
			get {
				return _values.Length;
			}
		}

		public IEnumerator<Decimal> GetEnumerator()
		{
			foreach ( var v in _values )
				yield return v;
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return this.GetEnumerator();
		}

	}
}
